﻿
@model FamilyJobsUI.Models.UserPoints_Index_Model

    @if (User.Identity.IsAuthenticated) { 
    <p>
        @Html.ActionLink("Create New", "Create")
    </p>
    }
    








@*<div id="clientsDb">
    @(Html.Kendo().Grid<FamilyJobsUI.Models.UserPoints_Index_RowModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(c => c.up_Points)
                .Title("Points")
                .Width(60);
            columns.Bound(c => c.pt_Name)
                .Title("Desc")
                .Width(250);
            columns.Bound(c => c.user_Name)
                .Title("Who")
                .Width(80);
            columns.Bound(c => c.up_CreatedOn)
                .Title("CreatedOn")
                .Format("{0:MM/dd/yyyy hh:mm tt}")
                .Width(80); 
        })
        .HtmlAttributes(new { style = "height: 380px;" })
        .Scrollable()
        .Groupable()
        .Sortable(a => 
            a.SortMode(GridSortMode.SingleColumn).Enabled(true)
            )
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Index_GetData", "UserPoints"))
            .Sort(a => a.Add("up_CreatedOn").Descending())
        )
    )
</div>*@

<style scoped>
    #clientsDb {
        width: 952px;
        height: 396px;
        margin: 20px auto 0;
        padding: 51px 4px 0 4px;
        background: url('@Url.Content("~/content/web/grid/clientsDb.png")') no-repeat 0 0;
    }
</style>




@if (Model.Items.Any()) { 


    <table class="table">
        <tr>
            <th>
                @Html.DisplayNameFor(model => Model.Items.First().up_Points)
            </th>
            <th>
                @Html.DisplayNameFor(model => Model.Items.First().pt_Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => Model.Items.First().user_Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => Model.Items.First().up_CreatedOn)
            </th>
            <th></th>
        </tr>
    
    @foreach (var item in Model.Items) {
        <tr>
            <td width="15px">
                @Html.DisplayFor(modelItem => item.up_Points)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.pt_Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.user_Name)
            </td>
            <td>
                <div>@item.up_CreatedOn.ToString("MM/dd/yyyy hh:mm tt")</div>
                
            </td>
            <td>
                @if (User.Identity.IsAuthenticated) {
                    <text>
                    @Html.ActionLink("Edit", "Edit", new { id=item.up_ID }) |
                    @Html.ActionLink("Details", "Details", new { id=item.up_ID }) |
                    @Html.ActionLink("Delete", "Delete", new { id=item.up_ID })
                    </text>
                }
            </td>
        </tr>
        if (!@String.IsNullOrWhiteSpace(item.up_Reason)) { 
        <tr>
            <td></td>
            <td colspan="99">
                @item.up_Reason
            </td>
        </tr>
        }
    }
    
    </table>
} else {
    <div class="warning">No recourds found</div>
}